package com.learn.multi_thread.A_BaseThread.B_Synchronized;

public class SaleTickets {
    /**
     *  继承方式实现售票
     *
     */
//    public static void main(String[] args) {
//        TicketThreadForThread t1 = new TicketThreadForThread();
//        TicketThreadForThread t2 = new TicketThreadForThread();
//        TicketThreadForThread t3 = new TicketThreadForThread();
//
//        t1.setName("窗口1");
//        t2.setName("窗口2");
//        t3.setName("窗口3");
//
//        t1.start();
//        t2.start();
//        t3.start();
//    }

    /**
     * 实现方式实现售票
     *
     */
    public static void main(String[] args) {
        TicketThreadForRunnable mr = new TicketThreadForRunnable();

        Thread t1 = new Thread(mr);
        Thread t2 = new Thread(mr);
        Thread t3 = new Thread(mr);

        t1.setName("窗口1");
        t2.setName("窗口2");
        t3.setName("窗口3");

        t1.start();
        t2.start();
        t3.start();
    }
}

